package com.ideafactory.client.utils;

import com.alibaba.fastjson.JSON;

import java.util.ArrayList;
import java.util.List;

public class JsonForBean {
	 public static <T> T getPerson(String jsonstring, Class<T> cls) {
	        T t = null;
	        try {
	            t = JSON.parseObject(jsonstring, cls);
	        } catch (Exception e) {
	        	e.printStackTrace();
	        }
	        return t;
	    }

	 public static <t> List<t> getPersonList(String jsonstring, Class<t> cls) {
	        List<t> list = new ArrayList<t>();
	        try {
	            list = JSON.parseArray(jsonstring, cls);
	        } catch (Exception e) {

	        }
	        return list;
	    }


    public static String beanToString(Object obj){
        return JSON.toJSONString(obj);
    }

}
